package com.huaqin.punan.sliding;

import java.io.Serializable;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.Toast;

/**
 * Copyright (c) 2012 All rights reserved.
 * 
 * @Description 主界面的Tab
 * @author punan
 */
public class MainActivity extends Activity implements Serializable {

	private Context context;
	private MyMoveView moveView;
	private LeftMenuView leftMenuView;
	public BaseView baseView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		requestWindowFeature(Window.FEATURE_NO_TITLE); 
		
		this.context = this;

		// 创建移动视图
		moveView = new MyMoveView(context);
		// 创建左边菜单视图
		leftMenuView = new LeftMenuView(this, moveView);

		/****************************************************/
		// 主界面
		baseView = new BaseView(context);
		baseView.setMyMoveView(moveView);// 赋值移动视图
		baseView.init();
		/***************************************************/

		// 移动视图默认界面：界面01.
		moveView.setMainView(baseView, leftMenuView, LeftMenuView.TAB_ITEM01);
		moveView.getLeft_show_view().setCurrentTab(LeftMenuView.TAB_ITEM01);

		setContentView(moveView);
		
	}
	
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		
		menu.add(0, 0, 0, "hello");
		menu.add(0, 1, 1, "hihi");
		return super.onCreateOptionsMenu(menu);
	}



	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		return super.onOptionsItemSelected(item);
	}



	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		return super.onPrepareOptionsMenu(menu);
	}



	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_MENU) {
			Toast.makeText(MainActivity.this, "123", Toast.LENGTH_LONG).show();
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
	}

	@Override
	protected void onPause() {
		super.onPause();

	}

	@Override
	protected void onResume() {
		super.onResume();

	}

}
